/* eslint-disable */
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { resolve } = require('path');
module.exports = {
    entry: './src/index.js',
    output: {
        filename: 'js/built.js',
        path: resolve(__dirname, 'build'),
    },
    module: {
        rules: [
            /**
             * 语法检查 eslint-loader,eslint
             * 注意：只检查自己的源代码，不检查第三方库
             * 设置检查规则
             */
            {
                test: /\.js$/,
                loader: 'eslint-loader',
                enforce: 'pre', // 编译前检查
                exclude: /node_modules/, // 不检测的文件
                include: [resolve(__dirname, 'src')],
                options: {
                    //自动修复eslint错误
                    fix: true,
                },
            },
        ],
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './src/index.html',
        }),
    ],
    mode: 'development',
};
